//
//  DPTestsModule.h
//  UITestingKit
//
//  Created by Ofri Wolfus on 03/02/07.
//  Copyright 2007 Ofri Wolfus. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UITestingKit/DPMacros.h>
#import <UITestingKit/DPTestStatistics.h>
#import <UITestingKit/DPUser.h>


// WARNING: This class is NOT thread safe!
// TODO: Make DPTestsModule thread safe.

@interface DPTestsModule : NSObject {
	NSBundle *bundle;
	NSDictionary *bundleInfo;
	NSMutableArray *cases;
	NSMutableArray *leftCases;
	NSMutableArray *completedCases;
	NSMutableArray *failedCases;
	NSMutableDictionary *statistics;
	id currentCase;
	BOOL catchExceptions;
	BOOL stopOnFailure;
	BOOL isValid;
	DPTestStatus status;
	Class userClass;
}

// Both methods require full paths!
+ (NSArray *)modulesAtDirectory:(NSString *)dirPath;
+ (id)moduleAtPath:(NSString *)path;

- (BOOL)stopsOnFailedTests;
- (void)setStopsOnFailedTests:(BOOL)flag;

- (BOOL)catchExceptions;
- (void)setCatchExceptions:(BOOL)flag;

- (NSString *)name;

- (DPTestStatistics *)nextTest;

- (BOOL)isValid;

- (NSDictionary *)statistics;

- (DPTestStatus)status;

- (Class)userClass;	// conforms to DPUser

- (unsigned)casesCount;

@end


DP_EXTERN NSString * const DPTestsModuleKey;
DP_EXTERN NSString * const DPTestCaseNameKey;
DP_EXTERN NSString * const DPTestNameKey;
DP_EXTERN NSString * const DPTestResultKey;
DP_EXTERN NSString * const DPReturnValueKey;
DP_EXTERN NSString * const DPExecutionTimeKey;
DP_EXTERN NSString * const DPFailReasonKey;
DP_EXTERN NSString * const DPTestStatisticsKey;

DP_EXTERN NSString * const DPTestsModuleCompletedNotification;
DP_EXTERN NSString * const DPTestsModuleFailedNotification;
